package com.tfjybj.itoo.exam.provider.service.impl;

import com.dmsdbj.itoo.tool.base.service.impl.BaseServicePlusImpl;
import com.tfjybj.itoo.exam.entity.EvaluationStudentEntity;
import com.tfjybj.itoo.exam.model.QueryTeacherByStudentIdModel;
import com.tfjybj.itoo.exam.provider.dao.EvaluationStudentDao;
import com.tfjybj.itoo.exam.provider.service.EvaluationStudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * EvaluationStudentService接口实现类
 * ${base}表
 *
 * @author 贾建清
 * @version 2.0.0
 * @since 2.0.0 2019-05-02 15:20:23
 */
@Service("evaluationStudentService")
public class EvaluationStudentServiceImpl extends BaseServicePlusImpl<EvaluationStudentDao, EvaluationStudentEntity> implements EvaluationStudentService {

    //region 模板生成
    @Resource
    private EvaluationStudentDao evaluationStudentDao;

    //endregion

    /* **********************************以下为非模板生成的内容********************************* */

    //根据studentId查询需要被评价的老师--刘竞博
    @Override
    public List<QueryTeacherByStudentIdModel> queryTeacherByStudentId(String studentId) {
        List<QueryTeacherByStudentIdModel> model = evaluationStudentDao.QueryTeacherByStudentId(studentId);
        for (int i = 0; i < model.size(); i++) {
            if ("0".equals(model.get(i).getStatus())) {
                model.get(i).setStatus("未评价");
            } else {
                model.get(i).setStatus("已评价");
            }
        }
        return model;
    }

    /**
     * 根据模板Id更新endTime
     * @param id 问卷id
     * @param  endTime 问卷状态
     * @return teEvaluationPaperModelList 问卷详情
     * @author 白爱民
     * @since 2019年7月20日19:42:59
     */
    public boolean updateEndTime(String id,Date endTime){
        return evaluationStudentDao.updateEndTime(id,endTime);
    }
}
